package com.xps.and.yuntong.Ui;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.umeng.socialize.media.UMImage;
import com.xps.and.yuntong.R;
import com.xps.and.yuntong.base.BaseActivity;
import com.umeng.socialize.ShareAction;
import com.umeng.socialize.UMShareListener;
import com.umeng.socialize.bean.SHARE_MEDIA;
import com.umeng.socialize.media.UMWeb;

/**
 * Created by administrator on 2017-12-12.
 */

public class MoreShezhiFenXiangActivity extends BaseActivity implements View.OnClickListener, UMShareListener {

    private ImageView iv_fanhui, iv_right,iv_share,iv_qq,iv_qq_kongjian,iv_friend_quan,iv_weixin;
    private TextView tv_middle;

    @Override
    protected int getLayout() {
        return R.layout.activity_more_shezhi_share;
    }

    @Override
    protected void setData() {

    }

    @Override
    protected void init(Bundle inBundle) {

        initView();
    }

    private void initView() {

        iv_fanhui = (ImageView) findViewById(R.id.iv_fanhui);
        iv_right = (ImageView) findViewById(R.id.iv_right);
        iv_share = (ImageView) findViewById(R.id.iv_share);
        iv_qq = (ImageView) findViewById(R.id.iv_qq);
        iv_qq_kongjian = (ImageView) findViewById(R.id.iv_qq_kongjian);
        iv_friend_quan = (ImageView) findViewById(R.id.iv_friend_quan);
        iv_weixin = (ImageView) findViewById(R.id.iv_weixin);
        tv_middle = (TextView) findViewById(R.id.tv_middle);
        tv_middle.setText(R.string.fen_xiang);




        iv_fanhui.setOnClickListener(this);
        iv_right.setOnClickListener(this);
        iv_share.setOnClickListener(this);
        iv_qq.setOnClickListener(this);
        iv_qq_kongjian.setOnClickListener(this);
        iv_friend_quan.setOnClickListener(this);
        iv_weixin.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {

        UMWeb webWX = new UMWeb("http://123.56.220.170/");
        webWX.setTitle("韵童校车");//标题
        webWX.setDescription("孩子上学不用愁，韵童校车来分忧！");//描述

        switch (v.getId()) {
            case R.id.iv_fanhui:

                finish();
                break;

            case R.id.iv_right:

                break;

            case R.id.iv_share:
//                Intent intent = new Intent(MoreShezhiKefuActivity.this, XiugaiPasswordTwoActivity.class);
//                startActivity(intent);
//                finish();

                break;
            case R.id.iv_qq:

                new ShareAction(this).setPlatform(SHARE_MEDIA.QQ)
                        .withText("hello")
                        .withMedia(webWX)
                        .setCallback(this)
                        .share();
                break;
            case R.id.iv_qq_kongjian:
                new ShareAction(this).setPlatform(SHARE_MEDIA.QZONE)
                        .withText("hello")
                        .withMedia(webWX)
                        .setCallback(this)
                        .share();

                break;
            case R.id.iv_friend_quan:
                new ShareAction(this).setPlatform(SHARE_MEDIA.WEIXIN_CIRCLE)
                        .withText("hello")
                        .withMedia(webWX)
                        .setCallback(this)
                        .share();

                break;
            case R.id.iv_weixin:

                new ShareAction(this).setPlatform(SHARE_MEDIA.WEIXIN)
                        .withText("hello")
                        .withMedia(webWX)
                        .setCallback(this)
                        .share();
                break;
            /*  这个是短信的 case R.id.al_share_sms:
                new ShareAction(this).setPlatform(SHARE_MEDIA.SMS)
                        .withText("hello")
                        .setCallback(this)
                        .share();
                break;*/

        }

    }

    @Override
    public void onStart(SHARE_MEDIA share_media) {

    }

    @Override
    public void onResult(SHARE_MEDIA share_media) {

    }

    @Override
    public void onError(SHARE_MEDIA share_media, Throwable throwable) {

    }

    @Override
    public void onCancel(SHARE_MEDIA share_media) {

    }
}
